<template>
  <a-card :bordered="false">
    <!-- table区域-begin -->
    <div>
      <vxe-grid
        style="width: 100%;"
        :height="curHeight"
        size="mini"
        align="center"
        highlight-hover-row
        stripe
        row-key
        row-id="selectedRowKeys"
        column-min-width="150"
        id="id"
        keep-source
        :loading="loading"
        border
        resizable
        auto-resize
        showOverflow
        showHeaderOverflow
        :pager-config="tablePage"
        ref="xGrid"
        :row-config="{ useKey: true,keyField: 'id',isCurrent:true,isHover:true}"
        :checkbox-config="{
          checkRowKeys:selectedRowKeys,
          trigger: 'row',
          highlight: true,
          reserve: true}"
        @sort-change="sortChange"
        @checkbox-change="checkboxChangeEvent"
        @checkbox-all="checkboxChangeEvent"
        :data="dataSource"
        :columns="columns"
        @page-change="handlePageChange"
      >
        <template v-slot:top>
          <div class="table-operator">
            <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
            <!-- 高级查询区域 -->
            <j-super-query :fieldList="superFieldList" ref="superQueryModal"
                           @handleSuperQuery="handleSuperQuery"></j-super-query>
            <a-dropdown v-if="selectedRowKeys.length > 0">
              <a-menu slot="overlay">
                <a-menu-item key="1" @click="batchDel">
                  <a-icon type="delete"/>
                  删除
                </a-menu-item>
              </a-menu>
              <a-button type="primary" icon="down">批量操作</a-button>
            </a-dropdown>
          </div>
        </template>
        <template v-slot:empty>
          <a-empty/>
        </template>
      </vxe-grid>
    </div>
    <!-- table区域-end -->
    <wcs-bcr-task-modal ref="modalForm" @ok="modalFormOk"></wcs-bcr-task-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {HYListMixin} from '@/mixins/HYListMixin'
import WcsBcrTaskModal from './modules/WcsBcrTaskModal'

export default {
  name: 'WcsBcrTaskList',
  mixins: [HYListMixin, mixinDevice],
  components: {
    WcsBcrTaskModal
  },
  data() {
    return {
      description: '扫码任务表管理页面',
      // 表头
      columns: [
        {type: "checkbox", width: 50, align: "center"},//多选
        {type: "seq", width: 50, align: "center"},//
        {title: '业务单据号', align: "center", field: 'relateCode'},
        {title: '任务号', align: "center", field: 'taskNo'},
        {title: '任务状态', align: "center", field: 'taskStatus_dictText'},
        {title: '母托盘', align: "center", field: 'palletNo'},
        {title: '子托盘', align: "center", field: 'subPalletNo'},
        {title: '扫码点', align: "center", field: 'source'},
        {title: '优先级', align: "center", field: 'priority'},
      ],
      url: {
        list: "/wcs/wcsBcrTask/list",
        delete: "/wcs/wcsBcrTask/delete",
        deleteBatch: "/wcs/wcsBcrTask/deleteBatch",
        exportXlsUrl: "/wcs/wcsBcrTask/exportXls",
        importExcelUrl: "wcs/wcsBcrTask/importExcel",
      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList();
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    initDictConfig() {
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({type: 'string', value: 'relateCode', text: '业务单据号', dictCode: ''})
      fieldList.push({type: 'string', value: 'taskNo', text: '任务号', dictCode: ''})
      fieldList.push({type: 'int', value: 'taskStatus', text: '任务状态', dictCode: ''})
      fieldList.push({type: 'string', value: 'palletNo', text: '母托盘', dictCode: ''})
      fieldList.push({type: 'string', value: 'subPalletNo', text: '子托盘', dictCode: ''})
      fieldList.push({type: 'string', value: 'source', text: '扫码点', dictCode: ''})
      fieldList.push({type: 'int', value: 'priority', text: '优先级', dictCode: ''})
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>